package com.yeshine.opendata.utils;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * Created by taohj on 2014/5/25.
 */
public class WebContext {

    public static HttpServletRequest getHttpServletRequest(){
        ServletRequestAttributes t = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes();
        HttpServletRequest req = t.getRequest();
        return  req;
    }


    public static HttpSession getHttpSession(){
        ServletRequestAttributes t = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes();
        HttpServletRequest req = t.getRequest();
        return  req.getSession();
    }



}
